'\" t
.\"     Title: hardlink
.\"    Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 2.0.15
.\"      Date: 2021-06-02
.\"    Manual: User Commands
.\"    Source: util-linux 2.37.2
.\"  Language: English
.\"
.TH "HARDLINK" "1" "2021-06-02" "util\-linux 2.37.2" "User Commands"
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.ss \n[.ss] 0
.nh
.ad l
.de URL
\fI\\$2\fP <\\$1>\\$3
..
.als MTO URL
.if \n[.g] \{\
.  mso www.tmac
.  am URL
.    ad l
.  .
.  am MTO
.    ad l
.  .
.  LINKSTYLE blue R < >
.\}
.SH "NAME"
hardlink \- link multiple copies of a file
.SH "SYNOPSIS"
.sp
\fBhardlink\fP [options] [\fIdirectory\fP|\fIfile\fP]...
.SH "DESCRIPTION"
.sp
\fBhardlink\fP is a tool which replaces copies of a file with hardlinks, therefore saving space.
.SH "OPTIONS"
.sp
\fB\-h\fP, \fB\-\-help\fP
.RS 4
print quick usage details to the screen.
.RE
.sp
\fB\-v\fP, \fB\-\-verbose\fP
.RS 4
More verbose output. If specified once, every hardlinked file is displayed, if specified twice, it also shows every comparison.
.RE
.sp
\fB\-q\fP, \fB\-\-quiet\fP
.RS 4
Quiet mode, don\(cqt print anything.
.RE
.sp
\fB\-n\fP, \fB\-\-dry\-run\fP
.RS 4
Do not act, just print what would happen.
.RE
.sp
\fB\-f\fP, \fB\-\-respect\-name\fP
.RS 4
Only try to link files with the same (basename). It\(cqs strongly recommended to use long options rather than \fB\-f\fP which is interpreted in a different way by others \fBhardlink\fP implementations.
.RE
.sp
\fB\-p\fP, \fB\-\-ignore\-mode\fP
.RS 4
Link/compare files even if their mode is different. This may be a bit unpredictable.
.RE
.sp
\fB\-o\fP, \fB\-\-ignore\-owner\fP
.RS 4
Link/compare files even if their owner (user and group) is different. It is not predictable.
.RE
.sp
\fB\-t\fP, \fB\-\-ignore\-time\fP
.RS 4
Link/compare files even if their time of modification is different. You almost always want this.
.RE
.sp
\fB\-X\fP, \fB\-\-respect\-xattrs\fP
.RS 4
Only try to link files with the same extended attributes.
.RE
.sp
\fB\-m\fP, \fB\-\-maximize\fP
.RS 4
Among equal files, keep the file with the highest link count.
.RE
.sp
\fB\-M\fP, \fB\-\-minimize\fP
.RS 4
Among equal files, keep the file with the lowest link count.
.RE
.sp
\fB\-O\fP, \fB\-\-keep\-oldest\fP
.RS 4
Among equal files, keep the oldest file (least recent modification time). By default, the newest file is kept. If \fB\-\-maximize\fP or \fB\-\-minimize\fP is specified, the link count has a higher precedence than the time of modification.
.RE
.sp
\fB\-x\fP, \fB\-\-exclude\fP \fIregex\fP
.RS 4
A regular expression which excludes files from being compared and linked.
.RE
.sp
\fB\-i\fP, \fB\-\-include\fP \fIregex\fP
.RS 4
A regular expression to include files. If the option \fB\-\-exclude\fP has been given, this option re\-includes files which would otherwise be excluded. If the option is used without \fB\-\-exclude\fP, only files matched by the pattern are included.
.RE
.sp
\fB\-s\fP, \fB\-\-minimum\-size\fP \fIsize\fP
.RS 4
The minimum size to consider. By default this is 1, so empty files will not be linked. The \fIsize\fP argument may be followed by the multiplicative suffixes KiB (=1024), MiB (=1024*1024), and so on for GiB, TiB, PiB, EiB, ZiB and YiB (the "iB" is optional, e.g., "K" has the same meaning as "KiB").
.RE
.SH "ARGUMENTS"
.sp
\fBhardlink\fP takes one or more directories which will be searched for files to be linked.
.SH "BUGS"
.sp
The original \fBhardlink\fP implementation uses the option \fB\-f\fP to force hardlinks creation between filesystem. This very rarely usable feature is no more supported by the current hardlink.
.sp
\fBhardlink\fP assumes that the trees it operates on do not change during operation. If a tree does change, the result is undefined and potentially dangerous. For example, if a regular file is replaced by a device, hardlink may start reading from the device. If a component of a path is replaced by a symbolic link or file permissions change, security may be compromised. Do not run hardlink on a changing tree or on a tree controlled by another user.
.SH "AUTHOR"
.sp
There are multiple \fBhardlink\fP implementations. The very first implementation is from Jakub Jelinek for Fedora distribution, this implementation has been used in util\-linux between versions v2.34 to v2.36. The current implementations is based on Debian version from Julian Andres Klode.
.SH "REPORTING BUGS"
.sp
For bug reports, use the issue tracker at \c
.URL "https://github.com/karelzak/util\-linux/issues" "" "."
.SH "AVAILABILITY"
.sp
The \fBhardlink\fP command is part of the util\-linux package which can be downloaded from \c
.URL "https://www.kernel.org/pub/linux/utils/util\-linux/" "Linux Kernel Archive" "."